home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
MATHS
/
RLAB
/
RLAB125.ZIP
/
!RLaB
/
help_ai
/
format
< prev
next >
Wrap
Text File
|
1995-03-13
|
1KB
|
60 lines
format:
Syntax: format ( )
format ( precision )
format ( width , precision )
format ( [width, precision] )
Description:
Format sets the output print format for all numeric output. If
no arguments are supplied, then the output print formats are
reset to the default values.
If format is called with one argument, then the arguments
value specifies the format precision. If two arguments are
supplied, then the 1st specifies the format field width, and
the second specifies the format precision. The one, or two
arguments can also be the first two elements of a matrix
argument.
Format returns a 2-element matrix contains the previous width
and precision values. Subsequently, this matrix can be used to
reset format.
Example:
> 123456789.123456789
1.235e+08
> format(10);
> 123456789.123456789
123456789.1
> format();
> a = rand(3,3)
a =
matrix columns 1 thru 3
1 0.3331 0.6646
0.9745 0.03694 0.08467
0.6475 0.1617 0.2041
> format(10);
> a
a =
matrix columns 1 thru 3
0.9999996424 0.3330855668 0.6646450162
0.9745196104 0.03694454208 0.08467286825
0.6474838853 0.1617118716 0.2041363865
> format(15,10);
> a
a =
matrix columns 1 thru 3
0.9999996424 0.3330855668 0.6646450162
0.9745196104 0.03694454208 0.08467286825
0.6474838853 0.1617118716 0.2041363865